package org.lowcoder.infra.event;

import java.util.Locale;

import org.lowcoder.sdk.util.LocaleUtils;

public enum EventType {

    USER_LOGIN("EVENT_TYPE_USER_LOGIN"),
    USER_LOGOUT("EVENT_TYPE_USER_LOGOUT"),

    // application
    VIEW("EVENT_TYPE_VIEW"),
    APPLICATION_CREATE("EVENT_TYPE_APPLICATION_CREATE"),
    APPLICATION_DELETE("EVENT_TYPE_APPLICATION_DELETE"),
    APPLICATION_UPDATE("EVENT_TYPE_APPLICATION_UPDATE"),
    APPLICATION_MOVE("EVENT_TYPE_APPLICATION_MOVE"),
    APPLICATION_RECYCLED("EVENT_TYPE_APPLICATION_RECYCLED"),
    APPLICATION_RESTORE("EVENT_TYPE_APPLICATION_RESTORE"),

    // folder
    FOLDER_CREATE("EVENT_TYPE_FOLDER_CREATE"),
    FOLDER_DELETE("EVENT_TYPE_FOLDER_DELETE"),
    FOLDER_UPDATE("EVENT_TYPE_FOLDER_UPDATE"),

    // query
    QUERY_EXECUTION("EVENT_TYPE_QUERY_EXECUTION"),
    // group
    GROUP_CREATE("EVENT_TYPE_GROUP_CREATE"),
    GROUP_UPDATE("EVENT_TYPE_GROUP_UPDATE"),
    GROUP_DELETE("EVENT_TYPE_GROUP_DELETE"),
    GROUP_MEMBER_ADD("EVENT_TYPE_GROUP_MEMBER_ADD"),
    GROUP_MEMBER_ROLE_UPDATE("EVENT_TYPE_GROUP_MEMBER_ROLE_UPDATE"),
    GROUP_MEMBER_LEAVE("EVENT_TYPE_GROUP_MEMBER_LEAVE"),
    GROUP_MEMBER_REMOVE("EVENT_TYPE_GROUP_MEMBER_REMOVE"),
    //system
    SERVER_START_UP("EVENT_TYPE_SERVER_START_UP"),

    // data source
    DATA_SOURCE_CREATE("DATA_SOURCE_CREATE"),
    DATA_SOURCE_UPDATE("DATA_SOURCE_UPDATE"),
    DATA_SOURCE_DELETE("DATA_SOURCE_DELETE"),
    DATA_SOURCE_PERMISSION_GRANT("DATA_SOURCE_PERMISSION_GRANT"),
    DATA_SOURCE_PERMISSION_UPDATE("DATA_SOURCE_PERMISSION_UPDATE"),
    DATA_SOURCE_PERMISSION_DELETE("DATA_SOURCE_PERMISSION_DELETE"),

    // library query
    LIBRARY_QUERY_CREATE("LIBRARY_QUERY_CREATE"),
    LIBRARY_QUERY_UPDATE("LIBRARY_QUERY_UPDATE"),
    LIBRARY_QUERY_DELETE("LIBRARY_QUERY_DELETE"),
    LIBRARY_QUERY_PUBLISH("LIBRARY_QUERY_PUBLISH"),
    ;

    private final String desc;

    EventType(String desc) {
        this.desc = desc;
    }

    public String getDesc(Locale locale) {
        return LocaleUtils.getMessage(locale, this.desc);
    }
}
